<%--
  Created by IntelliJ IDEA.
  User: zyf
  Date: 2020/9/15
  Time: 14:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<% Object sessionValues=session.getAttribute("session"); %>
<html>
<head>
    <title>展示新闻</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>

</head>
<body>
<table class="table table-hover">
    <p style="color: red">${message}</p>
    <thead>
    <tr>
        <td><a href="${pageContext.request.contextPath}/user/toAdd?userid=${session.userid}" class="btn btn-primary">添加</a></td>
    </tr>
    <tr>
        <th style="text-align: center" scope="col">编号</th>
        <th style="text-align: center" scope="col">标题</th>
        <th style="text-align: center" scope="col">发布时间</th>
        <th style="text-align: center" scope="col">发布人</th>
    </tr>
    </thead>
    <tbody>
    <c:forEach var="news" items="${news}">
        <tr>
            <th style="text-align: center" scope="row">${news.nid}</th>
            <td style="text-align: center">${news.ntitle}</td>
            <td style="text-align: center">${news.ntime}</td>
            <td style="text-align: center">${news.userinfo.urealname}</td>
        </tr>
    </c:forEach>
    </tbody>
</table>
</body>
</html>
